#ifndef DOU_H
#define DOU_H

#include <QWidget>
#include <QtSerialPort/QSerialPort>
#include <QtSerialPort/QSerialPortInfo>
#include <QtSerialPort/QtSerialPort>
#include <QTime>
#include <QString>

#include "hekr_protocol.h"

namespace Ui {
class dou;
}

class dou : public QWidget
{
    Q_OBJECT

public:
    explicit dou(QWidget *parent = 0);
    ~dou();
    void openserialport();     //打开串口
    void dou_sendbyte(unsigned char temp);
    QSerialPort *my_serialport = NULL;

private slots:
    void on_pushButton_9_clicked();
    void readUARTbuff();

    void on_pushButton_6_clicked();

    void on_pushButton_clicked();

    void on_pushButton_7_clicked();

    void on_pushButton_8_clicked();

    void on_pushButton_2_clicked();

    void on_pushButton_4_clicked();

    void on_pushButton_5_clicked();

    void on_pushButton_3_clicked();

private:
    Ui::dou *ui;
    void timerEvent(QTimerEvent *event);
    void SerialPortUpdata();     //获取可用串口
    unsigned char Chartohex(char temp);    //字符转十六进制
    unsigned char Qstringtohex(QString *str, unsigned char *temp);  //十六进制QString转十六进制数
    char *HekrModule[3]={"","STA模式(正常工作模式)","Hekr-config模式"};   //模块模式
    char *ModuleWIFICode[8]={"","正常连接路由器","连接路由器失败(未知原因)","正在连接路由器","WIFI密码错误","找不到路由器信号","连接路由器超时","未连接路由器"};
    char *ModuleCloudCode[4]={"","云端连接正常","DNS错误","云端连接超时"};
    char *Modulexinhao[6] ={"没有信号","信号强度等级1","信号强度等级2","信号强度等级3","信号强度等级4","信号强度等级5"};
    char *Modulechangce[2] ={"测试未通过","测试通过"};
};

#endif // DOU_H
